package test

import (
	"fmt"
	"fruit/actor/iactor"
	"fruit/tools/proto/proto_out/logic"
	"fruit/tools/redis"

	"google.golang.org/protobuf/proto"
)

type IService_Test interface {
	iactor.IActor
	Test() bool
}

type Test struct {
	*iactor.Actor
	A int
}

func (my *Test) InitIActor(...interface{}) interface{} {
	fmt.Println("init")
	return nil
}

func (my *Test) Test() bool {
	if my.Actor == nil {
		my.Actor = iactor.NewActor("123", "123")
	}

	// fmt.Println(iactor.Pop(my.Actor))
	return true
}

func Test2(msg proto.Message) {
	s := &logic.TestResp{
		Status: "OK",
	}
	proto.Merge(msg, s)
}

func Start() {
	redis_sub := redis.Connect("localhost:6379", "", 0)
	fmt.Println(redis.Publish(redis_sub, "zh23", nil))
	// t := &Test{}
	// a := &logic.TestResp{}
	// s := &logic.TestResp{
	// 	Status: "1",
	// }
	// Test2(s)
	// var a uint64 = 1 << 63
	// fmt.Println(a)
}
